﻿using Microsoft.Extensions.Logging;
using System;
using System.Threading.Tasks;
using Hangfire;

namespace DemoHangFire
{
    public class TestJob
    {


        private ILogger<TestJob> logger;
        public TestJob(ILogger<TestJob> logger)
        {
            this.logger = logger;
        }
        [AutomaticRetry(Attempts = 0)]
       [DisableConcurrentExecution(1)]
        public async Task Run()
        {
            logger.LogInformation($"Doing {DateTime.Now:yyyy-MM-dd HH:mm:ss}");
            await Task.Delay(1 * 80 * 1000);
            logger.LogInformation($"Done {DateTime.Now:yyyy-MM-dd HH:mm:ss}");
        }
    }
}
